#include <vector>
#include <iostream>
using namespace std;

int findPoisonedDuration(vector<int>& timeSeries, int duration) {
    int diff = 0, total = 0;
    for(int i=0;i<timeSeries.size()-1;i++){
        if(duration < timeSeries[i+1]-timeSeries[i]){
            total = total + duration;
        }else{
            total = total + timeSeries[i+1]-timeSeries[i];
        }
    }
    return total = total + duration;
}

int main(){
    vector<int> timeSeries = { 1,2 }; 
    int duration = 2;
    cout << findPoisonedDuration(timeSeries, duration) <<endl;
    return 0;
}